<?php
spl_autoload_register(function ($class_name) {
    $dir = explode(DIRECTORY_SEPARATOR, str_replace('\\', DIRECTORY_SEPARATOR, dirname(__FILE__)));
    array_pop($dir);
    $dir = implode(DIRECTORY_SEPARATOR, $dir);
    $path = $dir . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $class_name) . '.php';
    if (!class_exists($class_name) && file_exists($path)) {
        include $path;
    }
});